package com.kgc.scd.service.impl;

import com.kgc.scd.bean.Order;
import com.kgc.scd.bean.OrderItem;
import com.kgc.scd.bean.Seckill;
import com.kgc.scd.mapper.OrderItemMapper;
import com.kgc.scd.mapper.OrderMapper;
import com.kgc.scd.mapper.SeckillMapper;
import com.kgc.scd.service.SeckillOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created On : 2022/6/18.
 * <p>
 * Author     : 98730
 * <p>
 * Description: SeckillOrderServiceImpl
 */
@Service
@Slf4j
public class SeckillOrderServiceImpl implements SeckillOrderService {

    @Autowired(required = false)
    private OrderItemMapper orderItemMapper;

    @Autowired(required = false)
    private OrderMapper orderMapper;

    @Autowired(required = false)
    private SeckillMapper seckillMapper;

    @Override
    public int addSeckillOrderItem(OrderItem orderItem) {

        return orderItemMapper.insert(orderItem);
    }

    @Override
    public int addSeckillOrder(Order order) {
        return orderMapper.insert(order);
    }

    @Override
    public Seckill queryProIdByseckillId(String seckillId) {
        log.info("seckillId:{}",seckillId);
        return seckillMapper.selectByPrimaryKey(seckillId);
    }
}
